package org.chiv.nxone.network.base;

import io.vertx.core.AsyncResult;
import io.vertx.core.net.NetServerOptions;

/**
 * 网络组件服务提供者
 */
public interface ServerProvider {

    /**
     * 创建服务
     */
    void createServer(NetServerOptions netServerOptions);

    /**
     * 重置服务
     */
    void reload();

    boolean isAlive();

    default void listen(AsyncResult result) {
        String simpleName = this.getClass().getSimpleName();
        if (result.succeeded()) {
            System.out.println(simpleName + " server start success ");
        } else {
            System.out.println(simpleName + " server start fail ");
        }
    }
}
